package cn.kgc.service.impl;

import cn.kgc.bean.dto.UserDto;
import cn.kgc.bean.pojo.CUser;
import cn.kgc.mapper.UserMapper;
import cn.kgc.service.UserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, CUser> implements UserService {
    @Resource
    private UserMapper userMapper;

    @Override
    public CUser getUserInfo(String username) {
        QueryWrapper<CUser> wrapper = new QueryWrapper<>();
        wrapper.eq("username",username);
        CUser user = userMapper.selectOne(wrapper);
        return user;
    }

    @Override
    public UserDto getInfo(String username) {
        return userMapper.getInfo(username);
    }

    @Override
    public List<String> getUserRoleInfo(String username) {
        return userMapper.getUserRoleInfoMapper(username);
    }

    @Override
    public List<String> getUserPermissionInfoMapper(String username) {
        return userMapper.getUserPermissionInfoMapper(username);
    }


}
